#==============================================================================
#    Copyright (c) 2003-2006 Joel de Guzman
#    Copyright (c) 2014-2015 John Fletcher
#
#   Use, modification and distribution is subject to the Boost Software
#   License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
#   http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================

# bring in rules for testing
import testing ;
import os ;

import ../../config/checks/config : requires ;

if [ os.environ CI ]
{
    CI_DEFINES = <define>CI_SKIP_KNOWN_FAILURE=1 ;
    CI_DEFINES += <define>RUNNING_ON_TRAVIS=1 ;   # for backward compatibility
    CI_DEFINES += <define>RUNNING_ON_APPVEYOR=1 ; # for backward compatibility
}

project
    : requirements
        <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
        <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
        <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
        <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
        $(CI_DEFINES)
    ;

local multi-threading = <library>/boost/thread
                        <threading>multi <define>BOOST_ALL_NO_LIB=1 ;

test-suite phoenix_core :
    [ run core/custom_terminal.cpp ]
    [ run core/intel_test.cpp ]
    [ run core/primitives_tests.cpp ]
    ;

test-suite phoenix_stdlib :
    [ run stdlib/cmath.cpp ]
    ;

test-suite phoenix_operator :
    [ run operator/arithmetic_tests.cpp ]
    [ run operator/bitwise_tests.cpp ]
    [ run operator/comparison_tests.cpp ]
    [ run operator/if_else_tests.cpp ]
    [ run operator/io_tests.cpp ]
    [ run operator/logical_tests.cpp ]
    [ run operator/misc_binary_tests.cpp ]
    [ run operator/self_tests.cpp ]
    [ run operator/unary_tests.cpp ]
    [ run operator/member.cpp ]
    ;

test-suite phoenix_object :
    [ run object/cast_tests.cpp ]
    [ run object/new_delete_tests.cpp ]
    ;

test-suite phoenix_function :
    [ run function/adapt_function.cpp ]
    [ run function/function_tests.cpp ]
    [ run function/lazy_argument_tests.cpp ]
#    [ run function/lazy_compose_tests.cpp ]
#    [ run function/lazy_fold_tests.cpp ]
    [ run function/lazy_list_tests.cpp ]
    [ run function/lazy_list2_tests.cpp ]
    [ run function/lazy_list3_tests.cpp ]
    [ run function/lazy_make_pair_tests.cpp ]
#    [ run function/lazy_ptr_tests.cpp ]
#    [ run function/lazy_scan_tests.cpp ]
    [ run function/lazy_templated_struct_tests.cpp ]
#    [ run function/lazy_thunk_tests.cpp ]
    [ run function/lazy_operator_tests.cpp ]
    ;

test-suite phoenix_bind :
    [ run bind/bind_function_tests.cpp ]
    [ run bind/bind_function_object_tests.cpp ]
    [ run bind/bind_member_function_tests.cpp ]
    [ run bind/bind_member_variable_tests.cpp ]
    [ run bind/bug5782.cpp ]
    ;
    
test-suite phoenix_statement :
    [ run statement/if_tests.cpp ]
    [ run statement/loops_tests.cpp ]
    [ run statement/switch_tests.cpp ]
    [ run statement/exceptions.cpp ]
    [ run statement/bug5715.cpp ]
    ;
        
test-suite phoenix_container :
    [ run container/container_tests1a.cpp ] 
    [ run container/container_tests1b.cpp ] 
    [ run container/container_tests2a.cpp ] 
    [ run container/container_tests2b.cpp ] 
    [ run container/container_tests3a.cpp ] 
    [ run container/container_tests3b.cpp ] 
    [ run container/container_tests4a.cpp ] 
    [ run container/container_tests4b.cpp ] 
    [ run container/container_tests5a.cpp ] 
    [ run container/container_tests5b.cpp ] 
    [ run container/container_tests6a.cpp ] 
    [ run container/container_tests6b.cpp ] 
    [ run container/container_tests7a.cpp ]
    [ run container/container_tests7b.cpp ]
    [ run container/container_tests8a.cpp ]
    [ run container/container_tests8b.cpp : : : [ requires cxx11_hdr_unordered_map ] ]
    [ run container/container_tests9a.cpp : : : [ requires cxx11_hdr_unordered_map ] ]
    [ run container/container_tests9b.cpp : : : [ requires cxx11_hdr_unordered_map ] ]
    [ run container/container_tests10a.cpp : : : [ requires cxx11_hdr_unordered_map ] ]
    [ run container/container_tests10b.cpp : : : [ requires cxx11_hdr_unordered_map ] ]
    [ run container/container_tests11a.cpp : : : [ requires cxx11_hdr_unordered_set ] ]
    [ run container/container_tests11b.cpp : : : [ requires cxx11_hdr_unordered_set ] ]
    [ run container/container_tests12a.cpp : : : [ requires cxx11_hdr_unordered_set ] ]
    [ run container/container_tests12b.cpp : : : [ requires cxx11_hdr_unordered_set ] ]
    ;

test-suite phoenix_scope :
    [ run scope/lambda_tests1.cpp ]
    [ run scope/lambda_tests2.cpp ]
    [ run scope/lambda_tests3.cpp ]
    [ run scope/lambda_tests4.cpp ]
    [ run scope/lambda_tests5.cpp ]
    [ run scope/lambda_tests6.cpp ]
    [ run scope/lambda_tests7.cpp ]
    [ run scope/lambda_tests8.cpp ]
    [ run scope/lambda_tests9.cpp ]
    [ run scope/lambda_tests10.cpp ]
    [ run scope/lambda_tests11.cpp ]
    [ run scope/lambda_tests12.cpp ]
    [ run scope/lambda_tests13.cpp ]
    [ run scope/lambda_tests14.cpp ]
    [ run scope/lambda_tests15.cpp ]
    [ run scope/lambda_tests16.cpp ]
    [ run scope/lambda_tests17.cpp ]
    [ run scope/lambda_tests18.cpp ]
    [ run scope/lambda_tests19.cpp ]
    [ run scope/lambda_tests20.cpp ]
    [ run scope/lambda_tests21.cpp ]
    [ run scope/lambda_tests22.cpp ]
    [ run scope/lambda_tests23.cpp ]
    [ run scope/let_tests.cpp ]
    [ run scope/let_tests_113.cpp ]
#    [ run scope/let_tests_113a.cpp ]
    [ run scope/let_tests_157.cpp ]
#    [ run scope/let_tests_157a.cpp ]
    [ run scope/let_tests_rest.cpp ]
    [ run scope/more_lambda_tests.cpp ]
    [ run scope/more_let_tests.cpp ]
#    [ run scope/more_let_tests1.cpp ]
#    [ run scope/more_let_tests2a.cpp ]
#    [ run scope/more_let_tests2b.cpp ]
    [ run scope/dynamic_tests.cpp ]
    [ run scope/bug3289.cpp ]
    [ run scope/bug8298.cpp ]
    [ compile-fail scope/bug8298f.cpp ]
    [ run scope/bug_000008.cpp : : : $(multi-threading) ]
    ;

test-suite phoenix_algorithm :
    [ run algorithm/for_each.cpp ]
    [ run algorithm/for_each2.cpp ]
    [ run algorithm/for_test.cpp ]
    [ run algorithm/for_test2.cpp ]
    [ run algorithm/iteration.cpp ]
    [ run algorithm/transformation1.cpp ]
    [ run algorithm/transformation2.cpp ]
    [ run algorithm/transformation3.cpp ]
    [ run algorithm/transformation4.cpp ]
    [ run algorithm/querying.cpp ]
    [ run algorithm/querying_find.cpp ]
    [ run algorithm/querying2.cpp ]
    [ run algorithm/querying_find2.cpp ]
    ;

test-suite phoenix_boost_bind_compatibility :
    [ run boost_bind_compatibility/bind_and_or_test.cpp ]
    [ run boost_bind_compatibility/bind_const_test.cpp ]
    [ run boost_bind_compatibility/bind_cv_test.cpp ]
    [ run boost_bind_compatibility/bind_dm_test.cpp ]
#    [ run boost_bind_compatibility/bind_dm1_test.cpp ]
    [ run boost_bind_compatibility/bind_dm2_test.cpp ]
    [ run boost_bind_compatibility/bind_dm3_test.cpp ]
    [ run boost_bind_compatibility/bind_eq_test.cpp ]
    [ run boost_bind_compatibility/bind_eq2_test.cpp ]
    [ run boost_bind_compatibility/bind_eq3_test.cpp ]
    [ run boost_bind_compatibility/bind_fn2_test.cpp ]
    [ run boost_bind_compatibility/bind_function_test.cpp ]
    [ run boost_bind_compatibility/bind_interoperation_test.cpp ]
    [ run boost_bind_compatibility/bind_mf2_test.cpp ]
    [ run boost_bind_compatibility/bind_not_test.cpp ]
    [ run boost_bind_compatibility/bind_placeholder_test.cpp ]
    [ run boost_bind_compatibility/bind_ref_test.cpp ]
    [ run boost_bind_compatibility/bind_rel_test.cpp ]
    [ run boost_bind_compatibility/bind_rvalue_test.cpp ]
    [ run boost_bind_compatibility/bind_rv_sp_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp1_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp2_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp3_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp4_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp5_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp6_test.cpp ]
#    [ run boost_bind_compatibility/bind_rv_sp7_test.cpp ]
    [ run boost_bind_compatibility/bind_stateful_test.cpp ]
    [ run boost_bind_compatibility/bind_test.cpp ]
#    [ run boost_bind_compatibility/bind_void_dm_test.cpp ]
    ;

test-suite phoenix_bll_compatibility :
    [ run bll_compatibility/algorithm_test.cpp ]
    [ run bll_compatibility/bind_tests_advanced.cpp ]
#    [ run bll_compatibility/bind_tests_simple.cpp ]
#    [ run bll_compatibility/bind_tests_simple_f_refs.cpp ]
#    [ run bll_compatibility/bll_and_function.cpp ]
#    [ run bll_compatibility/cast_test.cpp ]
#    [ run bll_compatibility/constructor_tests.cpp ]
#    [ run bll_compatibility/control_structures.cpp ]
#    [ run bll_compatibility/exception_test.cpp ]
#    [ run bll_compatibility/extending_rt_traits.cpp ]
#    [ run bll_compatibility/is_instance_of_test.cpp ]
#    [ run bll_compatibility/istreambuf_test.cpp ]
#    [ run bll_compatibility/member_pointer_test.cpp ]
#    [ run bll_compatibility/operator_tests_simple.cpp ]
#    [ run bll_compatibility/phoenix_control_structures.cpp ]
#    [ run bll_compatibility/result_of_tests.cpp ]
#    [ run bll_compatibility/ret_test.cpp ]
#    [ run bll_compatibility/rvalue_test.cpp ]
#    [ run bll_compatibility/switch_construct.cpp ]
    ;

test-suite phoenix_regression :
    [ run regression/bug4853.cpp ]
    [ run regression/bug5626.cpp ]
    [ run regression/bug5824.cpp ]
 #   [ run regression/bug5875.cpp ]
    [ run regression/bug5968.cpp ]
    [ run regression/bug6040.cpp ]
    [ run regression/bug6268.cpp ]
    [ run regression/bug7165.cpp ]
    [ compile-fail regression/bug7166.cpp ]
    [ run regression/bug7624.cpp ]
    [ compile regression/from_array.cpp ]
    [ run regression/actor_assignment.cpp ]
    ;

test-suite phoenix_include :
    [ run include/bind.cpp ]
    [ run include/core.cpp ]
    [ run include/function.cpp ]
    [ run include/fusion.cpp ]
    [ run include/object.cpp ]
    [ run include/operator.cpp ]
    [ run include/scope.cpp ]
#    [ run include/spirit.cpp ]
#    [ run include/spirit_no_specialize.cpp ]
    [ run include/statement.cpp ]
    [ run include/stl.cpp ]
    [ run include/version.cpp ]
    [ run include/bind/bind_member_function.cpp ]
    [ run include/bind/bind_member_variable.cpp ]
    [ run include/core/actor.cpp ]
    [ run include/core/argument.cpp ]
    [ run include/core/arity.cpp ]
    [ run include/core/debug.cpp ]
    [ run include/core/domain.cpp ]
    [ run include/core/environment.cpp ]
    [ run include/core/expression.cpp ]
    [ run include/core/function_equal.cpp ]
    [ run include/core/is_actor.cpp ]
    [ run include/core/is_nullary.cpp ]
    [ run include/core/limits.cpp ]
    [ run include/core/meta_grammar.cpp ]
    [ run include/core/nothing.cpp ]
    [ run include/core/reference.cpp ]
    [ run include/core/terminal.cpp ]
 #   [ run include/core/bug7730.cpp ]
    [ run include/core/value.cpp ]
    [ run include/function/function.cpp : : : : function_function ]
    [ run include/function/lazy_headers.cpp ]
    [ run include/fusion/at.cpp ]
    [ run include/object/const_cast.cpp ]
    [ run include/object/construct.cpp ]
    [ run include/object/delete.cpp ]
    [ run include/object/dynamic_cast.cpp ]
    [ run include/object/new.cpp ]
    [ run include/object/reinterpret_cast.cpp ]
    [ run include/object/static_cast.cpp ]
    [ run include/operator/arithmetic.cpp ]
    [ run include/operator/bitwise.cpp ]
    [ run include/operator/comparison.cpp ]
    [ run include/operator/if_else.cpp ]
    [ run include/operator/io.cpp ]
    [ run include/operator/logical.cpp ]
    [ run include/operator/member.cpp : : : : operator_member ]
    [ run include/operator/self.cpp ]
    [ run include/scope/dynamic.cpp ]
    [ run include/scope/lambda.cpp ]
    [ run include/scope/let.cpp ]
    [ run include/scope/local_variable.cpp ]
    [ run include/scope/scoped_environment.cpp ]
    [ run include/scope/this.cpp ]
    [ run include/statement/do_while.cpp ]
    [ run include/statement/for.cpp ]
    [ run include/statement/if.cpp ]
    [ run include/statement/sequence.cpp ]
    [ run include/statement/switch.cpp ]
    [ run include/statement/throw.cpp ]
    [ run include/statement/try_catch.cpp ]
    [ run include/statement/while.cpp ]
    [ run include/stl/algorithm.cpp ]
    [ run include/stl/container.cpp ]
    [ run include/stl/container/container.cpp : : : : container_container ]
    [ run include/stl/algorithm/iteration.cpp : : : : include_iteration ]
    [ run include/stl/algorithm/querying.cpp : : : : include_querying ]
    [ run include/stl/algorithm/transformation.cpp ]
    [ run include/support/iterate.cpp ]
    [ run include/support/preprocessor/round.cpp ]
    ;
